package dashboard;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Random;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.apphosting.utils.remoteapi.RemoteApiPb.Request;

public class AdminController extends HttpServlet {
	
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws IOException, ServletException {
    

    String coursename = req.getParameter("coursename");
    String fase = req.getParameter("fase");
    String semester = req.getParameter("semester");
    String studyPoints =req.getParameter("studyPoints");
    CourseRegistry.getInstance().addCourse(new Course(coursename, Integer.parseInt(semester), Integer.parseInt(fase), Integer.parseInt(studyPoints)));
    
    resp.sendRedirect("admin.jsp");
    
	}
	
}
